An embedded system is a computer system that is embedded in various devices and application products for controlling these devices and application products. Generally, the development of an embedded system will involve a cross-compiling approach. So-called cross-compiling means that codes are generated on a platform but executed on another platform. The reason for adopting a cross-compiling approach may be that the target platform (the system where the generated program will be executed) does not allow or is not able to have the required compiler installed on it, yet some features of the compiler are needed in developing software for the target platform. Another reason may be that the target platform is lacking in the necessary resources, so there is no way to run the required compiler. Yet another reason may be that the target platform has not been built up (e.g., no operating system on it) to run the required compiler. With regard to an embedded system, usually there are not sufficient resources for compiling and optimizing application softwares, and there is also not enough space for the whole development or debug effort. Accordingly during the development of embedded software, the cross-compiling approach is usually applied.
However, for the software developers of embedded systems, the cross-compiling is not a simple process. On one hand, the cross-compiling-based building process is usually faster than the native building process. On the other hand, it is much more difficult and complex than the native building process. Taking the transporting of a third-party software as an example, in the case of the native building process, there is rarely a need for the developer to modify the building process, he simply needs to enter a building command. However, in cross-compiling, the developer usually needs to take several hours or days to debug the building process itself before he/she can see the building process running to the end successfully. The troubles in cross-compiling result from the fact that the compile-time platform on which the building process runs is not the same as the target platform, (i.e. the run-time platform on which the built-out program will run). More specifically, this divergence between the compile-time platform and the run-time platform will cause problems in the following two situations:
1) It is common that some steps in the building process will try to run interim programs built out by previous steps. The interim programs may be used to probe characteristics in some aspects of the target platform and, based on the execution results of the interim programs, the building process can adjust the compiling options of some programs accordingly. An example of such an interim program is the one used to test the bit field ordering of the target platform. Another possible use of an interim program is for generating a source code segment to be compiled in later steps.
Obviously, in the cross-compiling setting, these steps will result in errors because the generated target binary code usually is not executable on the building platform, (i.e. compile-time platform).
2) Before compiling a source file, the building process generally will try to probe whether libraries, on which the software package to be built will depend, exist on the target system and where they are located. If the building process could not find some of the libraries, the corresponding invoking codes might not be included in the further compiling results. If the building process could find necessary libraries, the correct paths of the object files and header files of these libraries should be informed to the compiler.
However, in a cross-compiling situation, such library probing is not an easy task. Such a task often incorrectly ends up with “fake” libraries which are installed on the building platform and have the same names but are not the required libraries. This will definitely cause compiling errors in later steps.
An article entitled “Cross-compilation” disclosed a method for solving the problem in the first situation mentioned above for cross-compiling. The article is available on the interne at research.att.com/˜gsf/download/crosscomp.html. The main idea of the method disclosed in the article is that, when the building process needs to run an interim program, the interim program will be remotely executed on the target system instead of on the compiling platform. However, this solution does not address the issue in the second situation mentioned above.